package com.xdcplus.web.service.impl;

import com.xdcplus.mp.service.impl.BaseServiceImpl;
import com.xdcplus.web.common.pojo.dto.DwWorkDateDTO;
import com.xdcplus.web.common.pojo.entity.DwWorkDate;
import com.xdcplus.web.common.pojo.vo.DwWorkDateVO;
import com.xdcplus.web.mapper.DwWorkDateMapper;
import com.xdcplus.web.service.DwWorkDateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工作日表(DwWorkDate)表服务实现类
 *
 * @author ma.qing
 * @since 2023-07-12 17:53:15
 */
@Slf4j
@Service("dwWorkDateService")
public class DwWorkDateServiceImpl extends BaseServiceImpl<DwWorkDateMapper, DwWorkDate, DwWorkDate, DwWorkDateVO> implements DwWorkDateService {

    @Autowired
    protected DwWorkDateMapper dwWorkDateMapper;

    @Override
    public void buildDwWorkDate(DwWorkDateDTO dwWorkDateDTO) {
        dwWorkDateMapper.deleteByYear(dwWorkDateDTO.getFabYear());
        dwWorkDateMapper.buildDwWorkDate(dwWorkDateDTO.getFabYear());
    }

    @Override
    public List<DwWorkDateVO> findYear() {
        return dwWorkDateMapper.findAllYear();
    }

    @Override
    public List<DwWorkDateVO> findMonth(DwWorkDateDTO dwWorkDateDTO) {
        return dwWorkDateMapper.findMonth(dwWorkDateDTO);
    }

    @Override
    public List<DwWorkDateVO> findWeek(DwWorkDateDTO dwWorkDateDTO) {
        return dwWorkDateMapper.findWeek(dwWorkDateDTO);
    }

    @Override
    public List<DwWorkDateVO> findDay(DwWorkDateDTO dwWorkDateDTO) {
        return dwWorkDateMapper.findDay(dwWorkDateDTO);
    }

    @Override
    public List<DwWorkDateVO> findWeekByMonth(DwWorkDateDTO dwWorkDateDTO) {
        return dwWorkDateMapper.findWeekByMonth(dwWorkDateDTO);
    }
}
